package com.example.aircraftwar.codes.aircraft;

import static com.example.aircraftwar.codes.activity.GameActivity.game;

import android.content.Context;

import com.example.aircraftwar.codes.factory.BloodPropFactory;
import com.example.aircraftwar.codes.factory.BombPropFactory;
import com.example.aircraftwar.codes.factory.BulletPropFactory;
import com.example.aircraftwar.codes.factory.PropFactory;
import com.example.aircraftwar.codes.prop.AbstractProp;
import com.example.aircraftwar.codes.strategy.ShootStrategy;

import java.util.LinkedList;
import java.util.List;

public class EliteEnemy extends BaseEnemyAircraft implements Observer{

    public EliteEnemy(Context context, int locationX, int locationY, int speedX, int speedY, int hp, ShootStrategy shootStrategy) {
        super(context, locationX, locationY, speedX, speedY, hp, shootStrategy);
    }

    @Override
    public int getScoreAdd(int score) {
        return score+20;
    }
    
    @Override
    public List<AbstractProp> produceProp() {
        List<AbstractProp> newPropList = new LinkedList<>();
        double propRandom = Math.random() * game.getPropReductionRate();
        PropFactory propFactory = null;
        if (propRandom > 0 && propRandom <= 0.25) {
            propFactory = new BloodPropFactory();
        } else if (propRandom > 0.25 && propRandom <= 0.5) {
            propFactory = new BulletPropFactory();
        } else if (propRandom > 0.5 && propRandom <= 1) {
            propFactory = new BombPropFactory();
        }
        //if (propRandom > 0 && propRandom <= 0.6) {
            newPropList.add(propFactory.createProp(context, this.getLocationX(),this.getLocationY()));
        //}
        return newPropList;
    }

    @Override
    public void react() {
        vanish();
    }
}